package com.example.sxy_smartpark

import android.app.Application
import com.alibaba.android.arouter.launcher.ARouter
//import coil3.ImageLoader
//import coil3.PlatformContext
//import coil3.SingletonImageLoader
//import coil3.network.okhttp.OkHttpNetworkFetcherFactory
//import coil3.request.crossfade
import com.example.lib_db.db.room.RoomDBUtils
import com.tencent.mmkv.MMKV
//import com.facebook.drawee.backends.pipeline.Fresco
//import com.squareup.picasso.Picasso
import dagger.hilt.android.HiltAndroidApp
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response

@HiltAndroidApp
class ParkApp:Application(){
    override fun onCreate() {
        super.onCreate()
//        //初始化Picasso
//        Picasso.setSingletonInstance(Picasso.Builder(this).build())
//
//        //初始化Fresco
//        Fresco.initialize(this)

        //初始化数据库
        RoomDBUtils.initRoom(this)

        //MMKV初始化
        MMKV.initialize(this)

        //ARouter跳转
        ARouter.openLog()
        ARouter.openDebug()
        ARouter.init(this)

    }

//    override fun newImageLoader(context: PlatformContext): ImageLoader {
//       return ImageLoader.Builder(context)
//           .crossfade(true)
//           .components {
//               add(
//                   OkHttpNetworkFetcherFactory(
//                       callFactory = {
//                           OkHttpClient().newBuilder()
////                               .addNetworkInterceptor(Interceptor{
////                                   override fun intercept(chain: Interceptor.Chain): Response {
////                                       val headers =it.Builder(
////                                           .set("Cache-Control","no-cache")
////                                       .buildO
////                                       val request =i
////                                       it.requestO.newBuilderO
////                                           .headers(headers)
////                                           .buildO
////                                       lit.proceed(request) ^Interceptor
////
////                                   }
////                               })
//                               .build()
//                       }
//                   )
//               )
//           }
//           .build()
 //   }
}